﻿using AutoMapper;
using ManagementApi.Models.Manage.ProjectSecurityDeposit;
using Modules.Project;
using PmSoft;

namespace ManagementApi.Models.Manage.ProjectSecurityDepositPaymentDetails
{
    public class ProjectSecurityDepositPaymentDetailsDto
    {
        /// <summary>
        /// 主键 
        ///</summary>
        public int Id { get; set; }
        /// <summary>
        /// 项目id 
        ///</summary>
        public int ProjectId { get; set; }
        /// <summary>
        /// 收支编号 
        ///</summary>
        public string Code { get; set; }
        /// <summary>
        /// 收支方式(现金,银行保函,工程担保公司保函,工程保证保险,其它) 
        ///</summary>
        public 收支方式 IncomeWay { get; set; }
        public string IncomeWayName { get; set; }
        /// <summary>
        /// 保函（险）单号 
        ///</summary>
        public string? InsurancePolicyNumbe { get; set; }
        /// <summary>
        /// 务工人员公民身份号码 
        ///</summary>
        public string CardNumber { get; set; }
        /// <summary>
        /// 务工人员姓名 
        ///</summary>
        public string PersonName { get; set; }
        /// <summary>
        /// 工资支付金额 
        ///</summary>
        public decimal PayAmount { get; set; }
        /// <summary>
        /// 工资支付方式(现金,银行卡,社会保障卡,其他) 
        ///</summary>
        public 工资支付方式 PayType { get; set; }
        public string PayTypeName { get; set; }
        /// <summary>
        /// 支出日期 
        ///</summary>
        public DateTime Expenditure { get; set; }
        /// <summary>
        /// 创建时间 
        ///</summary>
        public DateTime CreateTime { get; set; }
    }

    public static partial class ProjectSecurityDepositPaymentDetailsExceptions
    {
        public static ProjectSecurityDepositPaymentDetailsDto AsDto(this Modules.ProjectSecurityDepositPaymentDetails entity)
        {
            ProjectSecurityDepositPaymentDetailsDto dto = new ProjectSecurityDepositPaymentDetailsDto();
            var mapper = ServiceAccessor.GetService<IMapper>();
            mapper.Map(entity, dto);
            dto.IncomeWayName = entity.IncomeWay.GetDescription();
            dto.PayTypeName = entity.PayType.GetDescription();
            return dto;
        }
    }
}
